package com.rowline.admin.module.study.postprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyValues;
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor;

import java.beans.PropertyDescriptor;

/**
 * ClassName:MyInstantiationAwareBeanPostProcessor
 * Created by 245167
 * on 2018/4/28  28:11
 * description:
 */
public class MyInstantiationAwareBeanPostProcessor implements InstantiationAwareBeanPostProcessor {
    @Override
    public Object postProcessBeforeInstantiation(Class<?> aClass, String s) throws BeansException {
        System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        System.out.println("【InstantiationAwareBeanPostProcessor】 postProcessBeforeInstantiation()");
        return null;
    }

    @Override
    public boolean postProcessAfterInstantiation(Object o, String s) throws BeansException {
        System.out.println("【InstantiationAwareBeanPostProcessor】 postProcessAfterInstantiation()");
        System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        return false;
    }

    @Override
    public PropertyValues postProcessPropertyValues(PropertyValues propertyValues, PropertyDescriptor[] propertyDescriptors, Object o, String s) throws BeansException {
        System.out.println("【InstantiationAwareBeanPostProcessor】 postProcessPropertyValues()");
        return propertyValues;
    }

    @Override
    public Object postProcessBeforeInitialization(Object o, String s) throws BeansException {
        System.out.println("ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
        System.out.println("【InstantiationAwareBeanPostProcessor】 postProcessBeforeInitialization()");
        return o;
    }

    @Override
    public Object postProcessAfterInitialization(Object o, String s) throws BeansException {
        System.out.println("【InstantiationAwareBeanPostProcessor】 postProcessAfterInitialization()");
        System.out.println("ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
        return o;
    }
}
